<template>
    <a-row :gutter="24">
      <a-col :md="24">
        <a-card :bordered="false">
          <!-- 查询区域 -->
          <div class="table-page-search-wrapper">
            <a-form layout="inline" @keyup.enter.native="searchQuery">
              <a-row :gutter="24">
                <a-col :md="6" :sm="24">
                  <a-form-item label="登录名" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input placeholder="输入登录名模糊查询" v-model="queryParam.loginName"></a-input>
                  </a-form-item>
                </a-col>
                <a-col :md="6" :sm="24">
                    <a-form-item label="公司名" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input placeholder="输入公司名模糊查询" v-model="queryParam.name"></a-input>
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row :gutter="24">
                <!-- <a-col :md="6" :sm="24">
                  <a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
                    <a-input placeholder="输入手机号码模糊查询" maxLength="11" v-model="queryParam.tel"></a-input>
                  </a-form-item>
                </a-col> -->
                <a-col :md="6" :sm="24">
                  <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                    <a-button type="primary" @click="searchQuery">查询</a-button>
                    <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
                  </span>
                </a-col>
              </a-row>
            </a-form>
          </div>
          <!-- 操作按钮区域 -->
          <div class="table-operator" style="border-top: 5px">
            <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
          </div>
          <div>
            <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns" :dataSource="dataSource"
              :pagination="ipagination" :loading="loading" @change="handleTableChange"
              >
              <!-- :scroll="{ x: 1700}" -->
              <span slot="action" slot-scope="text, record">
                <a @click="myHandleDetail(record)">详情</a>
                <a-divider type="vertical" />
                <a @click="handleEdit(record)">编辑</a>
                <a-divider  v-if="btnEnableList.indexOf(6)>-1"  type="vertical"/>
                <a-divider  type="vertical" />
                <a-popconfirm  title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
  
              </span>
            </a-table>
          </div>
          <!-- table区域-end -->
          <tenantModal @save="save" ref="modalForm" @ok="modalFormOk"></tenantModal>
        </a-card>
      </a-col>
    </a-row>
  </template>
  
  <script>
  import tenantModal from './modules/tenantModal.vue'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import { getConfigOperatorList, getAllListIncome } from '../../api/api'
  export default {
    name: "/CustomList",
    mixins: [JeecgListMixin],
    components: {
      tenantModal,
      JInput
    },
    data() {
      return {
        labelCol: {
          span: 5
        },
        operatorList:[],
        opeList:[],
        wrapperCol: {
          span: 18,
          offset: 1
        },
        queryParam: {},
        credit_options: ["风险", "正常", "优秀", "极好", "黑名单"],
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          { title: '登录名', dataIndex: 'loginName', width: 90, align: "center" },
          { title: '公司名称', dataIndex: 'name', width: 120, align: "center" },
          { title: '法人', dataIndex: 'legal', width: 90, align: "center" },
          { title: '电话', dataIndex: 'tel', width: 90, align: "center" },
          // { title: '创建时间', dataIndex: 'createStr', width: 120, align: "center" },
          // { title: '创建用户', dataIndex: 'createUserStr', width: 80, align: "center" },
          // { title: '创建时间', dataIndex: 'createTimeStr', width: 120, align: "center" },
          // { title: '修改用户', dataIndex: 'updateUser', width: 80, align: "center"},
          // { title: '修改时间', dataIndex: 'updateTimeStr', width: 120, align: "center" },
          {
            title: '操作',
            dataIndex: 'action',
            scopedSlots: { customRender: 'action' },
            align: "center",
            width: 170
          }
        ],
        url: {
          list: "/tenant/list",
          delete: "/tenant/delete",
        },
      }
    },
    mounted(){
    },
    methods: {
      myHandleDetail(record) {
        this.$refs.modalForm.show(record);
        this.$refs.modalForm.title = "详情";
      },
      searchQuery() {
        this.loadData(1);
      },
      searchReset() {
        this.queryParam = {}
        this.loadData(1);
      },
      save() {
        this.loadData(1)
      },
  
      handleEdit: function (record) {
        this.$refs.modalForm.edit(record);
        this.$refs.modalForm.title = "编辑";
        this.$refs.modalForm.disableSubmit = false;
        if (this.btnEnableList.indexOf(1) > -1) {
          this.$refs.modalForm.isReadOnly = true
        }
      },
      handleSupply: function (record) {
        this.$refs.engineerSupplyModal.add(record);
        this.$refs.engineerSupplyModal.title = "工程补充";
        this.$refs.engineerSupplyModal.disableSubmit = false;
      }
    }
  }
  </script>
  <style scoped>
  @import '~@assets/less/common.less'
  </style>